import { ConfigService } from '@/api/configApi'

const cache = new Map<string, string | null>()

/**
 * 获取单个系统配置参数（带前端本地缓存）
 */
export async function getSysConfig(key: string, forceRefresh = false): Promise<string | null> {
  if (!forceRefresh && cache.has(key)) {
    return cache.get(key) ?? null
  }
  const value = await ConfigService.getValue(key)
  cache.set(key, value)
  return value
}


